1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.IMContextSimple; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gtk.IMContext; 31 private import gtk.c.functions; 32 public import gtk.c.types; 33 34 35 /** 36 * `GtkIMContextSimple` is an input method supporting table-based input methods. 37 * 38 * ## Compose sequences 39 * 40 * `GtkIMContextSimple` reads compose sequences from the first of the 41 * following files that is found: ~/.config/gtk-4.0/Compose, ~/.XCompose, 42 * /usr/share/X11/locale/$locale/Compose (for locales that have a nontrivial 43 * Compose file). The syntax of these files is described in the Compose(5) 44 * manual page. 45 * 46 * If none of these files is found, `GtkIMContextSimple` uses a built-in table 47 * of compose sequences that is derived from the X11 Compose files. 48 * 49 * Note that compose sequences typically start with the Compose_key, which is 50 * often not available as a dedicated key on keyboards. Keyboard layouts may 51 * map this keysym to other keys, such as the right Control key. 52 * 53 * ## Unicode characters 54 * 55 * `GtkIMContextSimple` also supports numeric entry of Unicode characters 56 * by typing <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>u</kbd>, followed by a 57 * hexadecimal Unicode codepoint. 58 * 59 * For example, 60 * 61 * Ctrl-Shift-u 1 2 3 Enter 62 * 63 * yields U+0123 LATIN SMALL LETTER G WITH CEDILLA, i.e. ģ. 64 * 65 * ## Dead keys 66 * 67 * `GtkIMContextSimple` supports dead keys. For example, typing 68 * 69 * dead_acute a 70 * 71 * yields U+00E! LATIN SMALL LETTER_A WITH ACUTE, i.e. á. Note that this 72 * depends on the keyboard layout including dead keys. 73 */ 74 public class IMContextSimple : IMContext 75 { 76 /** the main Gtk struct */ 77 protected GtkIMContextSimple* gtkIMContextSimple; 78 79 /** Get the main Gtk struct */ 80 public GtkIMContextSimple* getIMContextSimpleStruct(bool transferOwnership = false) 81 { 82 if (transferOwnership) 83 ownedRef = false; 84 return gtkIMContextSimple; 85 } 86 87 /** the main Gtk struct as a void* */ 88 protected override void* getStruct() 89 { 90 return cast(void*)gtkIMContextSimple; 91 } 92 93 /** 94 * Sets our main struct and passes it to the parent class. 95 */ 96 public this (GtkIMContextSimple* gtkIMContextSimple, bool ownedRef = false) 97 { 98 this.gtkIMContextSimple = gtkIMContextSimple; 99 super(cast(GtkIMContext*)gtkIMContextSimple, ownedRef); 100 } 101 102 103 /** */ 104 public static GType getType() 105 { 106 return gtk_im_context_simple_get_type(); 107 } 108 109 /** 110 * Creates a new `GtkIMContextSimple`. 111 * 112 * Returns: a new `GtkIMContextSimple` 113 * 114 * Throws: ConstructionException GTK+ fails to create the object. 115 */ 116 public this() 117 { 118 auto __p = gtk_im_context_simple_new(); 119 120 if(__p is null) 121 { 122 throw new ConstructionException("null returned by new"); 123 } 124 125 this(cast(GtkIMContextSimple*) __p, true); 126 } 127 128 /** 129 * Adds an additional table from the X11 compose file. 130 * 131 * Params: 132 * composeFile = The path of compose file 133 */ 134 public void addComposeFile(string composeFile) 135 { 136 gtk_im_context_simple_add_compose_file(gtkIMContextSimple, Str.toStringz(composeFile)); 137 } 138 139 /** 140 * Adds an additional table to search to the input context. 141 * Each row of the table consists of @max_seq_len key symbols 142 * followed by two #guint16 interpreted as the high and low 143 * words of a #gunicode value. Tables are searched starting 144 * from the last added. 145 * 146 * The table must be sorted in dictionary order on the 147 * numeric value of the key symbol fields. (Values beyond 148 * the length of the sequence should be zero.) 149 * 150 * Deprecated: Use gtk_im_context_simple_add_compose_file() 151 * 152 * Params: 153 * data = the table 154 * maxSeqLen = Maximum length of a sequence in the table 155 * nSeqs = number of sequences in the table 156 */ 157 public void addTable(ushort[] data, int maxSeqLen, int nSeqs) 158 { 159 gtk_im_context_simple_add_table(gtkIMContextSimple, data.ptr, maxSeqLen, nSeqs); 160 } 161 }